# -*- coding: utf-8 -*-

import unittest
from pprint import pprint
from user.kangmaUser import KangmaUser
from order.kangmaOrder import KangmaOrder


######################################################
#  app 加入进货单-去结算-提交订单-(他人代付)确认支付
######################################################

class OrderTestCase(unittest.TestCase):

    # 初始化
    def setUp(self):
        pprint('操作开始')
        # 先登录
        self.user = KangmaUser('app', '15955609518', '123456')

    def test_operator(self):
        o = KangmaOrder(self.user)
        # 1、商品加入进货单
        productIntoPurchasePARM = {
            'skuId': 1774,  # skuId
            'quantity': 1,  # 数量
            'mealId': None,  # 套餐ID
            'fullGiftId': None,  # 满赠活动ID
            'isGift': 0,  # 是否赠品  0 false 非赠品 1 true 是赠品
            'giftPrice': 100  # 赠品单价
        }
        code = o.productIntoPurchase(productIntoPurchasePARM)
        if code != 0:
            pprint('【商品加入进货单异常】')
            return

        # 2、去结算

        # 3、提交订单

    def tearDown(self):
        pprint('操作结束')


if __name__ == '__main__':
    unittest.main()
